import { EventEmitter } from 'events';

class Radio extends EventEmitter {
  constructor(station) {
    super();
    this.station = station;
    this.play();
  }

  play() {
    setTimeout(() => {
      this.emit('play', this.station);
      this.stop();
    }, 0);
  }

  stop() {
    setTimeout(() => {
      this.emit('stop', this.station);
    }, 5000);
  }
}

export { Radio };